package com.otaku.admin.dao.entity;

import com.baomidou.mybatisplus.annotation.TableName;

import java.util.Date;

@TableName("sys_token")
public class Token extends BaseEntity<Token> {
    private String id;
    private Integer userId;
    /**
     * token状态
     * 0：默认 可用
     * 1：过期或有新生成token
     */
    private Integer status;
    /**
     * 对应token access_token
     */
    private String token;
    /**
     * 过期时间
     */
    private Date timeOut;

    /**
     * 访问token
     * 过期时间 30分钟
     * redis保存时间 1 小时
     */
    private String accessToken;
    /**
     * refresh_token 刷新token
     */
    private String refreshToken;
    /**
     * 刷新token过期时间
     * 3天
     */
    private Date refreshTimeOut;

    public Token() {
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Date getTimeOut() {
        return timeOut;
    }

    public void setTimeOut(Date timeOut) {
        this.timeOut = timeOut;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public String getRefreshToken() {
        return refreshToken;
    }

    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }

    public Date getRefreshTimeOut() {
        return refreshTimeOut;
    }

    public void setRefreshTimeOut(Date refreshTimeOut) {
        this.refreshTimeOut = refreshTimeOut;
    }

    @Override
    public String toString() {
        return "Token{" +
                "id='" + id + '\'' +
                ", userId=" + userId +
                ", status=" + status +
                ", token='" + token + '\'' +
                ", timeOut=" + timeOut +
                ", accessToken='" + accessToken + '\'' +
                ", refreshToken='" + refreshToken + '\'' +
                ", refreshTimeOut=" + refreshTimeOut +
                '}';
    }
}
